import Vue from 'vue'
import Router from 'vue-router'
import Layout from './views/Layout'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      redirect: '/home',
      children:[{
        path: 'home', //首页
        component:  () =>import('@/views/Home'),
      },{
        path: 'software', //软件
        component:  () =>import('@/views/Software'),
      },{
        path: 'watch', //洞察
        component:  () =>import('@/views/Watch'),
      },{
        path: 'watchDetail', //洞察详情
        component:  () =>import('@/views/Watch/detail'),
      },{
        path: 'cooperation', //合作
        component:  () =>import('@/views/Cooperation'),
      },{
        path: 'about',  //关于我们
        component:  () =>import('@/views/About'),
      }]
    },
    {
      name: "login",
      path: '/login',  //登录
      component:  () =>import('@/views/Login'),
    }
  ],
  scrollBehavior (to, from, savedPosition) {
      if (savedPosition) {
          return savedPosition
      } else {
          return { x: 0, y: 0 }
      }
  }
})
